<script type="text/javascript">
$(document).ready(function() 
		{
			refreshMessages();
			$(".fancyMessage").fancybox({
				type: 'ajax',
				fitToView	: true,
				autoSize	: true,
				openEffect	: 'none',
				closeEffect	: 'none',
				afterClose	: function() {
					refreshMessages();
					return;
			    }
			});			
		});

function refreshMessages(){
	$('#listNotifications').empty();
	$('#listNotifications').append('<div id="loader"></div>');
	$('#loader').append('<img src="/images/ajax-loader.gif" alt="' + __('wait please...') + '" id="ajaxloader" />');
	var xhr = getXmlHttpRequest2();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4) {
			if (xhr.status == 200) {
				$('#listNotifications').append(xhr.responseText);
			} else {
				$('#listNotifications').append('Erreur à la récuperation de vos messages');
			}
			$('#loader').remove();
		}
	};
	xhr.open("POST","<?php print url_for('ajax/getListNotifications'); ?>",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send();
	
}

</script>

<?php $objDef = new objectDef('personne')?>
<fieldset><legend><?php echo $personne['name']?></legend>
<div style="float:left;">
<p><?php echo '<b>' . $personne['name'] . '</b> entrée le ' . $objDef->renderAttributeValue($personne, 'dateentree') ;?></p>
<?php echo $objDef->renderAttribute($personne, 'anciennete') ;?>
<?php echo $objDef->renderAttribute($personne, 'tel') ;?>
</div>
<div style="float:right;">
<?php echo $objDef->renderAttribute($personne, 'fonction') ;?>
<?php echo $objDef->renderAttribute($personne, 'codevehicule') ;?>
<?php echo link_to('<img src="/images/icons/48/logout.png" title="' . __('Log out') .'">', 'hometouch/logout')?>	
</div>
</fieldset>
<div id="listNotifications"></div>
<fieldset><legend>Services</legend>
<?php foreach ($services as $service): ?>
<a href="<?php echo url_for('@choixFormulaire?service=' . $service['id'] . '&personne=' . $personne['id'])?>">
<button class="button_a" style="width:250px; float: left;">
	<?php 
	$pic = $service['icone'];
	if(!$pic){
	$pic = 'service.png';
	}
	?>
	<img alt="" height="64" src="/images/services/<?php echo $pic;?>"><br/>
		<?php echo $service['description']?>
</button></a>
<?php endforeach;?>
</fieldset>
<fieldset><legend>Autres accès</legend>
<a href="<?php echo url_for('@listDossiers?view=mesdossiersencours&page=1')?>">
<button class="button_b" style="width:200px; float: left; min-height: 120px;">
	<img alt="" src="/images/mesdossiers.png"><br/>
		Dossiers en cours
</button></a>
<a href="<?php echo url_for('@listDossiers?view=atraiter&page=1')?>">
<button class="button_b" style="width:200px; float: left; min-height: 120px;">
	<img alt="" src="/images/mesdossiers.png"><br/>
		Dossiers à traiter
</button></a>

<a href="<?php echo url_for('@listDossiers?view=archive&page=1')?>">
<button class="button_b" style="width:200px; float: left; min-height: 120px;">
	<img alt="" src="/images/mesdossiers.png"><br/>
		Tous mes dossiers
</button></a>
<a href="<?php echo url_for('@messagesarchive')?>">
<button class="button_b" style="width:200px; float: left; min-height: 120px;">
	<img alt="" src="/images/icons/48/message.png"><br/>
		Archive des messages
</button></a>
<a href="<?php echo url_for('@documentationTouch')?>">
<button class="button_b" style="width:200px; float: left; min-height: 120px;">
	<img alt="" src="/images/icons/48/documentation.png"><br/>
		Documentation
</button></a>
</fieldset>